export function isType (
  type: 'Object' | 'Array' | 'String' | 'Number' | 'Symbol' | 'Function'
  ) {
  return (val: any) => {
    return Object.prototype.toString.call(val) === `[object ${type}]`
  }
}

export const isObject = isType('Object')
export const isArray = isType('Array')


export function cs(...args: any[]) {
  return args.reduce((cla, acc) => {
    if (isObject(acc)) {
      const entries = Object.entries(acc)

      for (const [key, value] of entries) {
        if (!!value) {
          cla += ' ' + key
        }
      }

    } else if (isArray(acc)) {
      for (const v of acc) {
        cla += ' ' + v
      }
    } else {
      cla += ' ' + acc
    }

    return cla
  }, '')
}